<template>
  <div class="categoryLeft">
    <scroll class="content" :probeType="2" :pull-up-load="true" ref="scroll">
      <div
        class="leftInfo"
        v-for="(item, index) in leftInfo"
        @click="leftClick(index)"
        :class="{ active: index == currentIndex }"
      >
        {{ item.title }}
      </div>
    </scroll>
  </div>
</template>

<script>
import Scroll from "components/common/scroll/scroll.vue";
export default {
  name: "categoryLeft",
  props: {
    leftInfo: {
      type: Array,
      default: [],
    },
  },
  data() {
    return {
      currentIndex: 0,
    };
  },
  methods: {
    leftClick(index) {
      this.currentIndex = index;
      this.$emit("leftClick", index);
    },
  },
  components: {
    Scroll,
  },
};
</script>

<style  scoped>
.categoryLeft {
  width: 30%;
  height: 100vh;
  background-color: rgb(246, 246, 246);
  float: left;
}
.content {
  overflow: hidden;
  position: absolute;
  top: 44px;
  bottom: 49px;
}
.leftInfo {
  height: 50px;
  width: 120px;
  font-size: 14px;
  color: black;
  line-height: 50px;
  text-align: center;
}
.active {
  background-color: white;
  font-weight: 700;
}
</style>
